#!/bin/bash

# Script to clone the repository from Gitee
# Usage: ./clone_from_gitee.sh [destination_directory]

# Set default destination directory
DEST_DIR="databasearchive"

# Check if destination directory is provided
if [ ! -z "$1" ]; then
    DEST_DIR="$1"
fi

echo "Cloning from Gitee repository..."
git clone https://gitee.com/gitdotkon/databasearchive.git "$DEST_DIR"

# Check if clone was successful
if [ $? -eq 0 ]; then
    echo "Successfully cloned from Gitee repository!"
    echo "Repository cloned to: $DEST_DIR"
    
    # Navigate to the directory and install dependencies
    cd "$DEST_DIR"
    echo "Installing dependencies..."
    pip install -r requirements.txt
    
    echo ""
    echo "Setup complete! You can now use the Archive Audit System:"
    echo "- Command line: python archive_audit.py"
    echo "- Web interface: python app.py"
    echo ""
    echo "Default login credentials: admin/admin"
else
    echo "Failed to clone from Gitee repository."
    echo "Please check your internet connection and try again."
fi
